cmake_minimum_required(VERSION 3.8)
project(addcustomcommand1)

add_custom_command(OUTPUT cmd_command COMMAND echo "hello command 1" COMMAND echo "hello command 2")
add_custom_target(cmd_command_target DEPENDS cmd_command)

add_custom_command(OUTPUT cmd_depends_1 COMMAND echo "hello depends 1")
add_custom_command(OUTPUT cmd_depends_2 COMMAND echo "hello depends 2" DEPENDS cmd_depends_1)
add_custom_target(cmd_depends_2_target DEPENDS cmd_depends_2)

add_custom_command(OUTPUT cmd_working_dir COMMAND touch index.html WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
add_custom_target(cmd_working_dir_target DEPENDS cmd_working_dir)

add_custom_command(OUTPUT cmd_comment COMMENT "hello comment")
add_custom_target(cmd_comment_target DEPENDS cmd_comment)

set(var "\${PATH}")
message(STATUS "var = ${var}")
add_custom_command(OUTPUT cmd_verbatim_1 COMMAND echo ${var})
add_custom_command(OUTPUT cmd_verbatim_2 COMMAND echo ${var} VERBATIM)
add_custom_target(cmd_verbatim_1_target DEPENDS cmd_verbatim_1)
add_custom_target(cmd_verbatim_2_target DEPENDS cmd_verbatim_2)

add_custom_command(OUTPUT cmd_expand_list_1 COMMAND echo "this;is;from;command")
add_custom_command(OUTPUT cmd_expand_list_2 COMMAND echo "this;is;from;command" COMMAND_EXPAND_LISTS)
add_custom_target(cmd_expand_list_1_target DEPENDS cmd_expand_list_1)
add_custom_target(cmd_expand_list_2_target DEPENDS cmd_expand_list_2)
